package com.infosys.cabplanningdao.schedule.dao.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Calendar;
import java.util.GregorianCalendar;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.jdbc.core.RowMapper;

import com.infosys.cabplanning.common.domain.Schedule;

public class ScheduleRowMapper implements RowMapper<Schedule> {

	@Override
	public Schedule mapRow(ResultSet rs, int rowNum) throws SQLException {
		Schedule schedule = new Schedule();
		schedule.setScheduleId(rs.getInt("schedule_id"));
		schedule.setStartTime(rs.getString("schedule_start_time"));
		Calendar calendar = new GregorianCalendar();
		calendar.setTime(rs.getDate("schedule_date"));
		schedule.setDate(calendar);
		return schedule;
	}

}
